package com.app.miwawa.api.system.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.framework.common.api.entity.CommonEntityUUID;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;


/**
 * <p>
 * 描述:</>
 * <p>Company:</>
 * @author zhaochong(赵冲)
 * @date 2016年3月7日下午18:14:01
 * @version 1.0.2016
 */

@Entity @Table(name = "TB_APP_ARTICLE")
public class Article extends CommonEntityUUID {

	/** serialVersionUID(long):. */
	private static final long serialVersionUID = -5106089592079145L;
	
	// 发帖人ID
	@Column(name = "author_id", length = 50, nullable = false)
	private String authorId;
	
	// 发帖人机构ID
	@Column(name = "shop_id", length = 50, nullable = false)
	private String shopId;
	
	// 文章类型（育儿宝典、热门活动）
	@Column(name = "type", length = 50, nullable = true)
	private String articleType;

	// 文章标题
	@Column(name = "title", length = 200, nullable = true)
	private String title;
	
	// 文章摘要
	@Column(name = "summary", length = 200, nullable = true)
	private String summary;
	
	// 文章内容
	@Lob @Basic(fetch = FetchType.LAZY)
	@Column(name = "content", nullable = true)
	private String content;
	
	// 文章图片
	@Lob @Basic(fetch = FetchType.LAZY)
	@Column(name = "pictures", nullable = true)
	private String pictures;
		
	// 发布时间
	@Temporal(TemporalType.TIMESTAMP)
	@JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
	@Column(name = "create_time", nullable = false)
	private Date createTime;
	
	/**
	 * 构造器
	 * 设置实体对象字段的默认值
	 */
	public Article() {
		this.status = "0";
		this.invalid = "F";
		this.createTime = new Date();
	}

	public String getAuthorId() {
		return authorId;
	}

	public void setAuthorId(String authorId) {
		this.authorId = authorId;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public String getArticleType() {
		return articleType;
	}

	public void setArticleType(String articleType) {
		this.articleType = articleType;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getPictures() {
		return pictures;
	}

	public void setPictures(String pictures) {
		this.pictures = pictures;
	}
}
